package com.sc.entity;

import com.mybatisflex.annotation.*;

import java.io.Serializable;
import java.sql.Date;
import java.time.LocalDateTime;
import java.util.List;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 员工表 实体类。
 *
 * @author JoeZhou
 * @since 2024-09-11
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(value = "ems_emp", schema = "study_club")
public class Emp implements Serializable {

    /**
     * ID
     */
    @Id(keyType = KeyType.Auto)
    private Long id;

    /**
     * 姓名
     */
    private String name;

    /**
     * 编号
     */
    private String eno;

    /**
     * 用户头像
     */
    private String avatar;

    /**
     * 性别
     */
    private Integer gender;

    private String idCard;

    /**
     * 入职日期
     */
    private Date hiredate;

    /**
     * 职位
     */
    private String job;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 联系电话
     */
    private String phone;

    /**
     * 微信号
     */
    private String wechat;

    /**
     * 紧急联系人姓名
     */
    private String emergencyContactName;

    /**
     * 紧急联系人电话
     */
    private String emergencyContactPhone;

    /**
     * 地址
     */
    private String address;

    /**
     * 密码
     */
    private String passwd;

    /**
     * 部门ID
     */
    private Integer deptId;

    /**
     * 备注
     */
    private String info;

    /**
     * 状态
     */
    private Integer status;

    @Column(isLogicDelete = true)
    private Integer isDelete;

    /**
     * 创建时间
     */
    private LocalDateTime created;

    /**
     * 更新时间
     */
    private LocalDateTime updated;

    /**
     * 版本
     */
    @Column(version = true)
    private Integer version;

    @RelationManyToMany(
            selfField = "id", targetField = "id",
            joinTable = "ems_emp_role",
            joinSelfColumn = "emp_id", joinTargetColumn = "role_id"
    )
    private List<Role> roles;

    @RelationManyToOne(selfField = "deptId")
    private Dept dept;

}
